<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class REXML::Parsers::XPathParser - rexml: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="../XMLTokens.html">REXML::XMLTokens</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-i-AdditiveExpr">#AdditiveExpr</a>
    <li ><a href="#method-i-AndExpr">#AndExpr</a>
    <li ><a href="#method-i-EqualityExpr">#EqualityExpr</a>
    <li ><a href="#method-i-FilterExpr">#FilterExpr</a>
    <li ><a href="#method-i-FunctionCall">#FunctionCall</a>
    <li ><a href="#method-i-LocationPath">#LocationPath</a>
    <li ><a href="#method-i-MultiplicativeExpr">#MultiplicativeExpr</a>
    <li ><a href="#method-i-NodeTest">#NodeTest</a>
    <li ><a href="#method-i-OrExpr">#OrExpr</a>
    <li ><a href="#method-i-PathExpr">#PathExpr</a>
    <li ><a href="#method-i-Predicate">#Predicate</a>
    <li ><a href="#method-i-PrimaryExpr">#PrimaryExpr</a>
    <li ><a href="#method-i-RelationalExpr">#RelationalExpr</a>
    <li ><a href="#method-i-RelativeLocationPath">#RelativeLocationPath</a>
    <li ><a href="#method-i-UnaryExpr">#UnaryExpr</a>
    <li ><a href="#method-i-UnionExpr">#UnionExpr</a>
    <li ><a href="#method-i-abbreviate">#abbreviate</a>
    <li ><a href="#method-i-expand">#expand</a>
    <li ><a href="#method-i-get_group">#get_group</a>
    <li ><a href="#method-i-namespaces-3D">#namespaces=</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-parse_args">#parse_args</a>
    <li ><a href="#method-i-preciate_to_string">#preciate_to_string</a>
    <li ><a href="#method-i-predicate">#predicate</a>
    <li ><a href="#method-i-predicate_to_path">#predicate_to_path</a>
    <li ><a href="#method-i-quote_literal">#quote_literal</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-REXML::Parsers::XPathParser">
    <h1 id="class-REXML::Parsers::XPathParser" class="class">
      class REXML::Parsers::XPathParser
    </h1>

    <section class="description">
    
<p>You don’t want to use this class.  Really.  Use <a href="../XPath.html"><code>XPath</code></a>, which is a wrapper for this class.  Believe me.  You don’t want to poke around in here. There is strange, dark magic at work in this code.  Beware.  Go back!  Go back while you still can!</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="AXIS">AXIS
          <dd><p><a href="XPathParser.html#method-i-RelativeLocationPath"><code>RelativeLocationPath</code></a></p>

<pre>|                                                    Step
  | (AXIS_NAME &#39;::&#39; | &#39;@&#39; | &#39;&#39;)                     AxisSpecifier
    NodeTest
      Predicate
  | &#39;.&#39; | &#39;..&#39;                                      AbbreviatedStep
|  RelativeLocationPath &#39;/&#39; Step
| RelativeLocationPath &#39;//&#39; Step</pre>
          <dt id="LITERAL">LITERAL
          <dd>
          <dt id="LOCAL_NAME_WILDCARD">LOCAL_NAME_WILDCARD
          <dd>
          <dt id="NODE_TYPE">NODE_TYPE
          <dd>
          <dt id="NT">NT
          <dd>
          <dt id="NUMBER">NUMBER
          <dd>
          <dt id="PI">PI
          <dd>
          <dt id="PREFIX_WILDCARD">PREFIX_WILDCARD
          <dd><pre>Returns a 1-1 map of the nodeset
The contents of the resulting array are either:
  true/false, if a positive match
  String, if a name match</pre>

<p><a href="XPathParser.html#method-i-NodeTest"><code>NodeTest</code></a></p>

<pre>| (&#39;*&#39; | NCNAME &#39;:&#39; &#39;*&#39; | QNAME)                NameTest
| &#39;*&#39; &#39;:&#39; NCNAME                                NameTest since XPath 2.0
| NODE_TYPE &#39;(&#39; &#39;)&#39;                             NodeType
| PI &#39;(&#39; LITERAL &#39;)&#39;                            PI
  | &#39;[&#39; expr &#39;]&#39;                                Predicate</pre>
          <dt id="QNAME">QNAME
          <dd>
          <dt id="VARIABLE_REFERENCE">VARIABLE_REFERENCE
          <dd><p>| <a href="XPathParser.html#VARIABLE_REFERENCE"><code>VARIABLE_REFERENCE</code></a> | ‘(’ expr ‘)’ | <a href="XPathParser.html#LITERAL"><code>LITERAL</code></a> | <a href="XPathParser.html#NUMBER"><code>NUMBER</code></a> | <a href="XPathParser.html#method-i-FunctionCall"><code>FunctionCall</code></a></p>
        </dl>
        </section>



                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-abbreviate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">abbreviate</span><span
                                class="method-args">(path_or_parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="abbreviate-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 42</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">abbreviate</span>(<span class="ruby-identifier">path_or_parsed</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">path_or_parsed</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">path_or_parsed</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">path_or_parsed</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">components</span> = []
  <span class="ruby-identifier">component</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">op</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">op</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:node</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;node()&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attribute</span>
      <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;@&quot;</span>
      <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:child</span>
      <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;&quot;</span>
      <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:descendant_or_self</span>
      <span class="ruby-identifier">next_op</span> = <span class="ruby-identifier">parsed</span>[<span class="ruby-value">0</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">next_op</span> <span class="ruby-operator">==</span> <span class="ruby-value">:node</span>
        <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
        <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;&quot;</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;descendant-or-self::&quot;</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:self</span>
      <span class="ruby-identifier">next_op</span> = <span class="ruby-identifier">parsed</span>[<span class="ruby-value">0</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">next_op</span> <span class="ruby-operator">==</span> <span class="ruby-value">:node</span>
        <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;.&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;self::&quot;</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:parent</span>
      <span class="ruby-identifier">next_op</span> = <span class="ruby-identifier">parsed</span>[<span class="ruby-value">0</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">next_op</span> <span class="ruby-operator">==</span> <span class="ruby-value">:node</span>
        <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;..&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">component</span> = <span class="ruby-string">&quot;parent::&quot;</span>
        <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:any</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;*&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:text</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;text()&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:following</span>, <span class="ruby-value">:following_sibling</span>,
          <span class="ruby-value">:ancestor</span>, <span class="ruby-value">:ancestor_or_self</span>, <span class="ruby-value">:descendant</span>,
          <span class="ruby-value">:namespace</span>, <span class="ruby-value">:preceding</span>, <span class="ruby-value">:preceding_sibling</span>
      <span class="ruby-identifier">component</span> = <span class="ruby-identifier">op</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&quot;_&quot;</span>, <span class="ruby-string">&quot;-&quot;</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;::&quot;</span>
      <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">component</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:qname</span>
      <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
      <span class="ruby-identifier">name</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">prefix</span><span class="ruby-string">+&quot;:&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:predicate</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;[&#39;</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">predicate_to_path</span>(<span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">abbreviate</span>(<span class="ruby-identifier">x</span>)}
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;]&#39;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:document</span>
      <span class="ruby-identifier">components</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:function</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;( &quot;</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">predicate_to_path</span>(<span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>[<span class="ruby-value">0</span>]) {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">abbreviate</span>(<span class="ruby-identifier">x</span>)}
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; )&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:literal</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">quote_literal</span>(<span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;UNKNOWN(&quot;</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">op</span>.<span class="ruby-identifier">inspect</span>
      <span class="ruby-identifier">component</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;)&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">components</span>
  <span class="ruby-keyword">when</span> [<span class="ruby-string">&quot;&quot;</span>]
    <span class="ruby-string">&quot;/&quot;</span>
  <span class="ruby-keyword">when</span> [<span class="ruby-string">&quot;&quot;</span>, <span class="ruby-string">&quot;&quot;</span>]
    <span class="ruby-string">&quot;//&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">components</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;/&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-expand" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">expand</span><span
                                class="method-args">(path_or_parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="expand-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">expand</span>(<span class="ruby-identifier">path_or_parsed</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">path_or_parsed</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">path_or_parsed</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">path_or_parsed</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">document</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">op</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">op</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:node</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;node()&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attribute</span>, <span class="ruby-value">:child</span>, <span class="ruby-value">:following</span>, <span class="ruby-value">:following_sibling</span>,
          <span class="ruby-value">:ancestor</span>, <span class="ruby-value">:ancestor_or_self</span>, <span class="ruby-value">:descendant</span>, <span class="ruby-value">:descendant_or_self</span>,
          <span class="ruby-value">:namespace</span>, <span class="ruby-value">:preceding</span>, <span class="ruby-value">:preceding_sibling</span>, <span class="ruby-value">:self</span>, <span class="ruby-value">:parent</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;/&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">op</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&quot;_&quot;</span>, <span class="ruby-string">&quot;-&quot;</span>)
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;::&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:any</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;*&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:qname</span>
      <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
      <span class="ruby-identifier">name</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">prefix</span><span class="ruby-string">+&quot;:&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:predicate</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;[&#39;</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">predicate_to_path</span>( <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">x</span>) }
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;]&#39;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:document</span>
      <span class="ruby-identifier">document</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;UNKNOWN(&quot;</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">op</span>.<span class="ruby-identifier">inspect</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;)&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-string">&quot;/&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">path</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">document</span>
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-namespaces-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">namespaces=</span><span
                                class="method-args">( namespaces )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="namespaces-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">namespaces=</span>( <span class="ruby-identifier">namespaces</span> )
  <span class="ruby-constant">Functions</span><span class="ruby-operator">::</span><span class="ruby-identifier">namespace_context</span> = <span class="ruby-identifier">namespaces</span>
  <span class="ruby-ivar">@namespaces</span> = <span class="ruby-identifier">namespaces</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span> <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/([\(\[])\s+/</span>, <span class="ruby-string">&#39;\1&#39;</span>) <span class="ruby-comment"># Strip ignorable spaces</span>
  <span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub!</span>( <span class="ruby-regexp">/\s+([\]\)])/</span>, <span class="ruby-string">&#39;\1&#39;</span>)
  <span class="ruby-identifier">parsed</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">OrExpr</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">parsed</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">rest</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParseException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Garbage component exists at the end: &quot;</span> <span class="ruby-operator">+</span>
                               <span class="ruby-node">&quot;&lt;#{rest}&gt;: &lt;#{path}&gt;&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">parsed</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-preciate_to_string" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">preciate_to_string</span><span
                                class="method-args">(parsed, &amp;block)</span>
                            </div>

                            <div class="method-description">
                              <p>For backward compatibility</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="XPathParser.html#method-i-predicate_to_path">predicate_to_path</a>
                            </div>
                          </div>

                  <div id="method-i-predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">predicate</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="predicate-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">predicate</span> <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">parsed</span> = []
  <span class="ruby-constant">Predicate</span>( <span class="ruby-node">&quot;[#{path}]&quot;</span>, <span class="ruby-identifier">parsed</span> )
  <span class="ruby-identifier">parsed</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-predicate_to_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">predicate_to_path</span><span
                                class="method-args">(parsed) { |parsed| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="predicate_to_path-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 174</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">predicate_to_path</span>(<span class="ruby-identifier">parsed</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">path</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">parsed</span>[<span class="ruby-value">0</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-value">:and</span>, <span class="ruby-value">:or</span>, <span class="ruby-value">:mult</span>, <span class="ruby-value">:plus</span>, <span class="ruby-value">:minus</span>, <span class="ruby-value">:neq</span>, <span class="ruby-value">:eq</span>, <span class="ruby-value">:lt</span>, <span class="ruby-value">:gt</span>, <span class="ruby-value">:lteq</span>, <span class="ruby-value">:gteq</span>, <span class="ruby-value">:div</span>, <span class="ruby-value">:mod</span>, <span class="ruby-value">:union</span>
    <span class="ruby-identifier">op</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">op</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:eq</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;=&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:lt</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;&lt;&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:gt</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;&gt;&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:lteq</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;&lt;=&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:gteq</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;&gt;=&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:neq</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;!=&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:union</span>
      <span class="ruby-identifier">op</span> = <span class="ruby-string">&quot;|&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">left</span> = <span class="ruby-identifier">predicate_to_path</span>( <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
    <span class="ruby-identifier">right</span> = <span class="ruby-identifier">predicate_to_path</span>( <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">left</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; &quot;</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">op</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; &quot;</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">right</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:function</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;(&quot;</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">argument</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;, &quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">predicate_to_path</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;)&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:literal</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">quote_literal</span>(<span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">shift</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">yield</span>( <span class="ruby-identifier">parsed</span> )
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">&quot; &quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="XPathParser.html#method-i-preciate_to_string">preciate_to_string</a>
                            </div>

                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-AdditiveExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">AdditiveExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-AdditiveExpr"><code>AdditiveExpr</code></a> (‘+’ | ‘-’) <a href="XPathParser.html#method-i-MultiplicativeExpr"><code>MultiplicativeExpr</code></a> | <a href="XPathParser.html#method-i-MultiplicativeExpr"><code>MultiplicativeExpr</code></a></p>

                              <div class="method-source-code" id="AdditiveExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 505</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">AdditiveExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">MultiplicativeExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*(\+|-)\s*/</span>
      <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?+</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:plus</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:minus</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">MultiplicativeExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-AndExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">AndExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-AndExpr"><code>AndExpr</code></a> S ‘and’ S <a href="XPathParser.html#method-i-EqualityExpr"><code>EqualityExpr</code></a> | <a href="XPathParser.html#method-i-EqualityExpr"><code>EqualityExpr</code></a></p>

                              <div class="method-source-code" id="AndExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 438</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">AndExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">EqualityExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*( and )/</span>
      <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:and</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">EqualityExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-EqualityExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">EqualityExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-EqualityExpr"><code>EqualityExpr</code></a> (‘=’ | ‘!=’)  <a href="XPathParser.html#method-i-RelationalExpr"><code>RelationalExpr</code></a> | <a href="XPathParser.html#method-i-RelationalExpr"><code>RelationalExpr</code></a></p>

                              <div class="method-source-code" id="EqualityExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 457</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">EqualityExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">RelationalExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*(!?=)\s*/</span>
      <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?!</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:neq</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:eq</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">RelationalExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-FilterExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">FilterExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-FilterExpr"><code>FilterExpr</code></a> <a href="XPathParser.html#method-i-Predicate"><code>Predicate</code></a> | <a href="XPathParser.html#method-i-PrimaryExpr"><code>PrimaryExpr</code></a></p>

                              <div class="method-source-code" id="FilterExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 608</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">FilterExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">path_before_primary_expr</span> = <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-constant">PrimaryExpr</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">path_before_primary_expr</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">path_before_primary_expr</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-constant">Predicate</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span>)
  <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-FunctionCall" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">FunctionCall</span><span
                                class="method-args">(rest, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| FUNCTION_NAME ‘(’ ( expr ( ‘,’ expr )* )? ‘)’</p>

                              <div class="method-source-code" id="FunctionCall-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 663</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">FunctionCall</span> <span class="ruby-identifier ruby-title">rest</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">path</span>, <span class="ruby-identifier">arguments</span> = <span class="ruby-identifier">parse_args</span>(<span class="ruby-identifier">rest</span>)
  <span class="ruby-identifier">argset</span> = []
  <span class="ruby-keyword">for</span> <span class="ruby-identifier">argument</span> <span class="ruby-keyword">in</span> <span class="ruby-identifier">arguments</span>
    <span class="ruby-identifier">args</span> = []
    <span class="ruby-constant">OrExpr</span>( <span class="ruby-identifier">argument</span>, <span class="ruby-identifier">args</span> )
    <span class="ruby-identifier">argset</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">argset</span>
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-LocationPath" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">LocationPath</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="XPathParser.html#method-i-LocationPath"><code>LocationPath</code></a></p>

<pre>| RelativeLocationPath
| &#39;/&#39; RelativeLocationPath?
| &#39;//&#39; RelativeLocationPath</pre>

                              <div class="method-source-code" id="LocationPath-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 243</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">LocationPath</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:document</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
      <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:descendant_or_self</span>
      <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:node</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-constant">RelativeLocationPath</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">parsed</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-MultiplicativeExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">MultiplicativeExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-MultiplicativeExpr"><code>MultiplicativeExpr</code></a> (‘*’ | S (‘div’ | ‘mod’) S) <a href="XPathParser.html#method-i-UnaryExpr"><code>UnaryExpr</code></a> | <a href="XPathParser.html#method-i-UnaryExpr"><code>UnaryExpr</code></a></p>

                              <div class="method-source-code" id="MultiplicativeExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 528</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">MultiplicativeExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">UnaryExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*(\*| div | mod )\s*/</span>
      <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:mult</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">elsif</span> <span class="ruby-node">$1</span>.<span class="ruby-identifier">include?</span>( <span class="ruby-string">&quot;div&quot;</span> )
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:div</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:mod</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">UnaryExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-NodeTest" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">NodeTest</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="NodeTest-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 343</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">NodeTest</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">original_path</span> = <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">path</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">PREFIX_WILDCARD</span>
    <span class="ruby-identifier">prefix</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:qname</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">prefix</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^\*/</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:any</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">NODE_TYPE</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&#39;-&#39;</span>, <span class="ruby-string">&#39;_&#39;</span>).<span class="ruby-identifier">intern</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">PI</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">literal</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*\)/</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">LITERAL</span>
      <span class="ruby-identifier">literal</span> = <span class="ruby-node">$1</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParseException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Missing &#39;)&#39; after processing instruction&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">?)</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:processing_instruction</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">literal</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">LOCAL_NAME_WILDCARD</span>
    <span class="ruby-identifier">prefix</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:namespace</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">prefix</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">QNAME</span>
    <span class="ruby-identifier">prefix</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-node">$2</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">prefix</span> = <span class="ruby-string">&quot;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">prefix</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:qname</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">prefix</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">original_path</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-OrExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">OrExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-OrExpr"><code>OrExpr</code></a> S ‘or’ S <a href="XPathParser.html#method-i-AndExpr"><code>AndExpr</code></a> | <a href="XPathParser.html#method-i-AndExpr"><code>AndExpr</code></a></p>

                              <div class="method-source-code" id="OrExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 419</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">OrExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">AndExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*( or )/</span>
      <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:or</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">AndExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-PathExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">PathExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-LocationPath"><code>LocationPath</code></a> | <a href="XPathParser.html#method-i-FilterExpr"><code>FilterExpr</code></a> (‘/’ | ‘//’) <a href="XPathParser.html#method-i-RelativeLocationPath"><code>RelativeLocationPath</code></a></p>

                              <div class="method-source-code" id="PathExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 590</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">PathExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">FilterExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">rest</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">RelativeLocationPath</span>(<span class="ruby-identifier">rest</span>, <span class="ruby-identifier">n</span>)
      <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">n</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-identifier">rest</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">LocationPath</span>(<span class="ruby-identifier">rest</span>, <span class="ruby-identifier">n</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\A[\/\.\@\[\w*]/</span>
  <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-Predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">Predicate</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Filters the supplied nodeset on the predicate(s)</p>

                              <div class="method-source-code" id="Predicate-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Predicate</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">original_path</span> = <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">original_path</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?[</span>
  <span class="ruby-identifier">predicates</span> = []
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?[</span>
    <span class="ruby-identifier">path</span>, <span class="ruby-identifier">expr</span> = <span class="ruby-identifier">get_group</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">predicates</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expr</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">expr</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">predicates</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">pred</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">preds</span> = []
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:predicate</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">preds</span>
    <span class="ruby-constant">OrExpr</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">preds</span>)
  }
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-PrimaryExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">PrimaryExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="PrimaryExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 626</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">PrimaryExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">path</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">VARIABLE_REFERENCE</span>
    <span class="ruby-identifier">varname</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:variable</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">varname</span>
    <span class="ruby-comment">#arry &lt;&lt; @variables[ varname ]</span>
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^(\w[-\w]*)(?:\()/</span>
    <span class="ruby-identifier">fname</span> = <span class="ruby-node">$1</span>
    <span class="ruby-identifier">tmp</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">path</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">fname</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">NT</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">tmp</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:function</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">fname</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-constant">FunctionCall</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">parsed</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">NUMBER</span>
    <span class="ruby-identifier">varname</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> <span class="ruby-node">$2</span> <span class="ruby-operator">:</span> <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:literal</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">varname</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;.&#39;</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">varname</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">varname</span>.<span class="ruby-identifier">to_i</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">LITERAL</span>
    <span class="ruby-identifier">varname</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> <span class="ruby-node">$2</span> <span class="ruby-operator">:</span> <span class="ruby-node">$1</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:literal</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">varname</span>
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^\(/</span>                                               <span class="ruby-comment">#/</span>
    <span class="ruby-identifier">path</span>, <span class="ruby-identifier">contents</span> = <span class="ruby-identifier">get_group</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">contents</span> = <span class="ruby-identifier">contents</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
    <span class="ruby-identifier">n</span> = []
    <span class="ruby-constant">OrExpr</span>( <span class="ruby-identifier">contents</span>, <span class="ruby-identifier">n</span> )
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-RelationalExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">RelationalExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-RelationalExpr"><code>RelationalExpr</code></a> (‘&lt;’ | ‘&gt;’ | ‘&lt;=’ | ‘&gt;=’) <a href="XPathParser.html#method-i-AdditiveExpr"><code>AdditiveExpr</code></a> | <a href="XPathParser.html#method-i-AdditiveExpr"><code>AdditiveExpr</code></a></p>

                              <div class="method-source-code" id="RelationalExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 480</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">RelationalExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">AdditiveExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*([&lt;&gt;]=?)\s*/</span>
      <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?&lt;</span>
        <span class="ruby-identifier">sym</span> = <span class="ruby-string">&quot;lt&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">sym</span> = <span class="ruby-string">&quot;gt&quot;</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">sym</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;eq&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?=</span>
      <span class="ruby-identifier">n</span> = [ <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">intern</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">AdditiveExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-RelativeLocationPath" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">RelativeLocationPath</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="RelativeLocationPath-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 267</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">RelativeLocationPath</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">original_path</span> = <span class="ruby-identifier">path</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>

    <span class="ruby-keyword">return</span> <span class="ruby-identifier">original_path</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span>

    <span class="ruby-comment"># (axis or @ or &lt;child::&gt;) nodetest predicate  &gt;</span>
    <span class="ruby-comment"># OR                                          &gt;  / Step</span>
    <span class="ruby-comment"># (. or ..)                                    &gt;</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?.</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?.</span>
        <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:parent</span>
        <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:node</span>
        <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:self</span>
        <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:node</span>
        <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">path_before_axis_specifier</span> = <span class="ruby-identifier">path</span>
      <span class="ruby-identifier">parsed_not_abberviated</span> = []
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?@</span>
        <span class="ruby-identifier">parsed_not_abberviated</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:attribute</span>
        <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
        <span class="ruby-comment"># Goto Nodetest</span>
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">AXIS</span>
        <span class="ruby-identifier">parsed_not_abberviated</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">$1</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&#39;-&#39;</span>,<span class="ruby-string">&#39;_&#39;</span>).<span class="ruby-identifier">intern</span>
        <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
        <span class="ruby-comment"># Goto Nodetest</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">parsed_not_abberviated</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:child</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">path_before_node_test</span> = <span class="ruby-identifier">path</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-constant">NodeTest</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">parsed_not_abberviated</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">path_before_node_test</span>
        <span class="ruby-keyword">return</span> <span class="ruby-identifier">path_before_axis_specifier</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-constant">Predicate</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">parsed_not_abberviated</span>)

      <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">parsed_not_abberviated</span>)
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">original_path</span> = <span class="ruby-identifier">path</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">lstrip</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">original_path</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span>

    <span class="ruby-keyword">return</span> <span class="ruby-identifier">original_path</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">?/</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
      <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:descendant_or_self</span>
      <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:node</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-UnaryExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">UnaryExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| ‘-’ <a href="XPathParser.html#method-i-UnaryExpr"><code>UnaryExpr</code></a> | <a href="XPathParser.html#method-i-UnionExpr"><code>UnionExpr</code></a></p>

                              <div class="method-source-code" id="UnaryExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 553</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">UnaryExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(\-*)/</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-node">$&#39;</span>
  <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">and</span> ((<span class="ruby-node">$1</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span>) <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>)
    <span class="ruby-identifier">mult</span> = <span class="ruby-value">-1</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">mult</span> = <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">:neg</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mult</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">path</span> = <span class="ruby-constant">UnionExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">concat</span>( <span class="ruby-identifier">n</span> )
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-UnionExpr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">UnionExpr</span><span
                                class="method-args">(path, parsed)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>| <a href="XPathParser.html#method-i-UnionExpr"><code>UnionExpr</code></a> ‘|’ <a href="XPathParser.html#method-i-PathExpr"><code>PathExpr</code></a> | <a href="XPathParser.html#method-i-PathExpr"><code>PathExpr</code></a></p>

                              <div class="method-source-code" id="UnionExpr-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 571</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">UnionExpr</span> <span class="ruby-identifier ruby-title">path</span>, <span class="ruby-identifier">parsed</span>
  <span class="ruby-identifier">n</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-constant">PathExpr</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\s*(\|)\s*/</span>
      <span class="ruby-identifier">n</span> = [ <span class="ruby-value">:union</span>, <span class="ruby-identifier">n</span>, [] ]
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">PathExpr</span>( <span class="ruby-node">$&#39;</span>, <span class="ruby-identifier">n</span>[<span class="ruby-value">-1</span>] )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">n</span> )
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">parsed</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">n</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">rest</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_group" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_group</span><span
                                class="method-args">(string)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="XPathParser.html#method-i-get_group"><code>get_group</code></a>( ‘[foo]bar’ ) -&gt; [‘bar’, ‘[foo]’]</p>

                              <div class="method-source-code" id="get_group-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 676</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_group</span> <span class="ruby-identifier">string</span>
  <span class="ruby-identifier">ind</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">depth</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">st</span> = <span class="ruby-identifier">string</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>]
  <span class="ruby-identifier">en</span> = (<span class="ruby-identifier">st</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;(&quot;</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;)&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;]&quot;</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span>,<span class="ruby-value">1</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">st</span>
      <span class="ruby-identifier">depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">en</span>
      <span class="ruby-identifier">depth</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">ind</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">ind</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">length</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">depth</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
  [<span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>], <span class="ruby-identifier">string</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">ind</span><span class="ruby-value">-1</span>]]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse_args" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse_args</span><span
                                class="method-args">( string )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse_args-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 694</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_args</span>( <span class="ruby-identifier">string</span> )
  <span class="ruby-identifier">arguments</span> = []
  <span class="ruby-identifier">ind</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">inquot</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">inapos</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">depth</span> = <span class="ruby-value">1</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-value">?&quot;</span>
      <span class="ruby-identifier">inquot</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">inquot</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">inapos</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">?&#39;</span>
      <span class="ruby-identifier">inapos</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">inapos</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">inquot</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">inquot</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">inapos</span>
        <span class="ruby-keyword">case</span> <span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span>]
        <span class="ruby-keyword">when</span> <span class="ruby-value">?(</span>
          <span class="ruby-identifier">depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
            <span class="ruby-identifier">string</span> = <span class="ruby-identifier">string</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
            <span class="ruby-identifier">ind</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">when</span> <span class="ruby-value">?)</span>
          <span class="ruby-identifier">depth</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
            <span class="ruby-identifier">s</span> = <span class="ruby-identifier">string</span>[<span class="ruby-value">0</span>,<span class="ruby-identifier">ind</span>].<span class="ruby-identifier">strip</span>
            <span class="ruby-identifier">arguments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
            <span class="ruby-identifier">string</span> = <span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span><span class="ruby-value">+1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">when</span> <span class="ruby-value">?,</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
            <span class="ruby-identifier">s</span> = <span class="ruby-identifier">string</span>[<span class="ruby-value">0</span>,<span class="ruby-identifier">ind</span>].<span class="ruby-identifier">strip</span>
            <span class="ruby-identifier">arguments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
            <span class="ruby-identifier">string</span> = <span class="ruby-identifier">string</span>[<span class="ruby-identifier">ind</span><span class="ruby-value">+1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
            <span class="ruby-identifier">ind</span> = <span class="ruby-value">-1</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">ind</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">ind</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">length</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">depth</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
  [<span class="ruby-identifier">string</span>,<span class="ruby-identifier">arguments</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-quote_literal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">quote_literal</span><span
                                class="method-args">( literal )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="quote_literal-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/parsers/xpathparser.rb, line 224</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">quote_literal</span>( <span class="ruby-identifier">literal</span> )
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">literal</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
    <span class="ruby-comment"># XPath 1.0 does not support escape characters.</span>
    <span class="ruby-comment"># Assumes literal does not contain both single and double quotes.</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">literal</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;&#39;&quot;</span>)
      <span class="ruby-node">&quot;\&quot;#{literal}\&quot;&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-node">&quot;&#39;#{literal}&#39;&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">literal</span>.<span class="ruby-identifier">inspect</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

